import {ref, onMounted, reactive} from 'vue'
import {defineStore} from 'pinia'
import {userListAPI} from "@/apis/system/user/user";

export const useUserListStore = defineStore('UserList', () => {
    const page = ref({
        page: 1,
        size: 5,
        total: 0,
    })
    const userList = ref([])
    const getUserList = async (selectKey = "") => {
        const {data: res} = await userListAPI(page.value.size, page.value.page, selectKey)
        if (res.code === 200) {
            userList.value = res.data.records
            page.value.total = res.data.total
        }
    }
    return {userList, getUserList, page}
})
